package com.funtl.framework.web.service.log.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import com.funtl.framework.java.exception.DaoException;
import com.funtl.framework.java.exception.ServiceException;
import com.funtl.framework.java.orm.hibernate.service.IHibernateDao;
import com.funtl.framework.web.entity.LogInfo;
import com.funtl.framework.web.service.log.ILogInfoService;

@Component
public class LogInfoServiceImpl implements ILogInfoService {
	private IHibernateDao hibernateDao;

	//common service

	@Override
	public LogInfo get(LogInfo entity) throws ServiceException {
		return null;
	}

	@Override
	public Long getCount(LogInfo entity) throws ServiceException {
		try {
			return hibernateDao.getCount(entity);
		} catch (DaoException e) {
			throw new ServiceException("getCount", e);
		}
	}

	@Override
	public List<LogInfo> getList(LogInfo entity) throws ServiceException {
		return null;
	}

	@Override
	public String insert(LogInfo entity) throws ServiceException {
		try {
			hibernateDao.insert(entity);
			return null;
		} catch (DaoException e) {
			throw new ServiceException("insert", e);
		}
	}

	@Override
	public String delete(LogInfo entity) throws ServiceException {
		return null;
	}

	@Override
	public String update(LogInfo entity) throws ServiceException {
		return null;
	}

	@Override
	public List<LogInfo> page(LogInfo entity) throws ServiceException {
		try {
			return hibernateDao.getPagingList(entity, entity.getPageIndex(), entity.getPageSize(), "createDate", "DESC");
		} catch (DaoException e) {
			throw new ServiceException("page", e);
		}
	}
	
	//getter setter
	
	public IHibernateDao getHibernateDao() {
		return hibernateDao;
	}

	@Resource
	public void setHibernateDao(IHibernateDao hibernateDao) {
		this.hibernateDao = hibernateDao;
	}
	
}
